BuffEffect26 = BaseBuffEffect:new();
BuffEffect26.__index = BuffEffect26;

function BuffEffect26:new()
    local object = {};
    setmetatable(object, BuffEffect26);
    return object;
end

function BuffEffect26:add(fight,buff)
    local values =decodeJsonStrToTabel(buff.buffBean.f_Value);
    buff.parameter = {values[1]};
    fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 增加抵挡致命伤害BUFF效果，次数："..buff.parameter[1]);
    return BaseBuffEffect:add(fight,buff)
end

function BuffEffect26:action(fight,buff,...)
    local target = buff.target;
    local result = select("3",...);
    local skill = select("2",...);
    local skillBean = skill.skill.skillBean;

    if skillBean.f_TriggerFigthHurt == EnumConst.SkillDamageTypeEnum.HEAL then
        return EnumConst.IBuffEffect.SUCCESS;
    end
    if result.damage <=0 then
        return EnumConst.IBuffEffect.SUCCESS;
    end
    if result.damage >= target.hp then

        result.damage = 0;
        buff.parameter[1] = buff.parameter[1] - 1;
        fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 触发抵抗致死BUFF效果，剩余次数："..buff.parameter[1]);
    end
    fightLog("[DAMAGE]"..buff.source.fighterId.."对"..buff.target.fighterId.."计算BUFF("..buff.modelId..")减伤伤害[4]结果"..subDigitalNum(result.damage,4));

    if buff.parameter[1] <= 0 then
        return EnumConst.IBuffEffect.REMOVE;
    end
    return EnumConst.IBuffEffect.RESET;
end
